<template>
  <div class="bigbox">
    <HomeNewVue
      ref="listItemRef"
      :home="'home'"
      @toEditPage="toEditPage"
      @previewEvent="previewEvent"
      @yulanFn="yulanFn"
      @bianjiFn="bianjiFn"
      url="132154564564564"
      :folderId="folderId"
      :hideItemMenus="hideItemMenus"
      :officeFileType="3"
    >
      <!-- <template #homenonedata>
        <div class="homenonetitle">
          暂无项目内容
        </div>
      </template> -->
    </HomeNewVue>
  </div>
  <!-- <div class="newone" v-else>
    21312312312
  </div> -->
</template>
<script lang="ts" setup>
// homenonedata 无数据时的插槽
// homenoneimg 无数据时的图片
// homeqingkong  头部清空按钮是否出现
// homenewcard  图表模式第一个新增是否显示
// homebottomjiahao  首页最下方是否出现加号
// listswitch  是否出现图表列表转换
// newjiahaoicon  加号加号插槽(li里面)
// newjiahao  新增小方框样式
// url  链接地址
import HomeNewVue from "./HomeNew.vue";
import { useRouter } from "vue-router";
import OfficeGlobal from "@/utils/officeglobal";
import { onMounted, ref, watch } from "vue";
import { getCcontentList } from "@/api/content";
import { useMainStore } from "@/store";

const router = useRouter();
let aaa = { background: "red" };
const mainStore = useMainStore();

// const props = defineProps([''])
// 文件夹id   -1 为全部文件
const folderId = ref(mainStore.folderID);
// 进入预览页
const previewEvent = (item: any, screen = 1) => {
  // toEditPage(item)
  // console.log(id);
  // enterScreening()
  router.push({
    path: "/freeeditor",
    query: {
      appFileInfoId: item.appFileInfoId,
      screen: "1",
      operate: 3
      // name: item.officeTitle,
    },
  });
};

// 进入编辑页
const toEditPage = (item: any) => {
  if (item.ownerSharerList) {
    localStorage.setItem(
      "ownerSharerList",
      JSON.stringify(item.ownerSharerList)
    );
  }
  router.push({
    path: "/freeeditor",
    query: {
      name: item.fileName,
      appFileInfoId: item.appFileInfoId,
      screen: "0",
      operate: 2,
      // id: item.officeMainId,
      // officeId: item.officeId,
    },
  });
};
// 操作 ref
const listItemRef: any = ref(null);
// home
const hideItemMenus = ref(false);
// 父组件传文件夹id
const postFolderId = (id: any) => {
  folderId.value = id;
};

// 隐藏内容区右键菜单
const hideRightMenu = (flag: any) => {
  listItemRef.value.hideRightMenu(false);
  hideItemMenus.value = flag;
};
// 第二步：暴露方法
defineExpose({ postFolderId, hideRightMenu });
// TopLeftslot  右上角插槽
// 进入预览页
const yulanFn = (item: any) => {};
// 进入编辑页
const bianjiFn = (item: any) => {};

// 修改  首页数据没有的话显示新增时另一个界面  由于不能往组件内写只能外面引用
// 获取列表
</script>
<style lang="scss" scoped>
.bigbox {
  background: #22252c;
  // border-radius: 30px;
  height: 100%;
  padding: 20px 0;
  // margin: 0 20px 20px 0;
}

.homenonetitle {
  width: 108px;
  height: 18px;
  font-family: PingFangSC-Regular;
  font-size: 18px;
  color: #7a8bbf;
  letter-spacing: 0;
  line-height: 18px;
  font-weight: 400;
}
</style>
